package ext.trace.scene;

import ext.trace.geom.Geom;
import java.util.LinkedList;
import math.region.AABB3;

public class Bucket
{
    
    protected LinkedList<Geom> mG;
    
    protected AABB3 mBox;
    
    
    public Bucket(AABB3 bounds)
    {
        this.mG = new LinkedList<>();
        this.mBox = bounds.copy();
    }
    
    
    public void add(Geom g)
    {
        this.mG.addLast(g);
    }
    
    public void clear()
    {
        this.mG.clear();
    }
    
    
    public Bucket copy()
    {
        Bucket copy = new Bucket(this.mBox);
        for (Geom g : this.mG)
        {
            copy.mG.addLast(g);
        }
        copy.mBox = this.mBox.copy();
        return copy;
    }
    
    public String toString()
    {
        StringBuilder s = new StringBuilder();
        s.append("Bucket\n   NGeom: ");
        s.append(this.mG.size());
        return s.toString();
    }
    
}
